package org.jeecgframework.web.system.pojo.base;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.*;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.core.common.entity.IdEntity;
import org.jeecgframework.poi.excel.annotation.Excel;

/**   
 * @Title: Entity
 * @Description: 购物车
 * @author onlineGenerator
 * @date 2016-08-31 10:39:13
 * @version V1.0   
 *
 */
@Entity
@Table(name = "cbs_shopping_cart", schema = "")
@SuppressWarnings("serial")
public class CbsShoppingCartEntity extends IdEntity implements java.io.Serializable {
	/**id*/
	private java.lang.String id;
	/**零件id*/
	@Excel(name="零件id")
	private CbsPartInfoEntity part;
	/**数量*/
	@Excel(name="数量")
	private int count;

    /*是否选中*/
    private int checkStatus;

    /*订单*/
    private CbsProcurementNoteEntity noteEntity;

	/**createName*/
	private java.lang.String createName;
	/**createBy*/
	private java.lang.String createBy;
	/**createDate*/
	private java.util.Date createDate;
	/**updateName*/
	private java.lang.String updateName;
	/**updateBy*/
	private java.lang.String updateBy;
	/**updateDate*/
	private java.util.Date updateDate;

    private double price;

    private String partName;

    private List<String> partImg = new ArrayList<String>();

    @Transient
    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Transient
    public String getPartName() {
        return partName;
    }

    public void setPartName(String partName) {
        this.partName = partName;
    }

    @Transient
    public List<String> getPartImg() {
        return partImg;
    }

    public void setPartImg(List<String> partImg) {
        this.partImg = partImg;
    }

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "order_id")
    public CbsProcurementNoteEntity getNoteEntity() {
        return noteEntity;
    }

    public void setNoteEntity(CbsProcurementNoteEntity noteEntity) {
        this.noteEntity = noteEntity;
    }

    @Column(name = "check_status")
    public int getCheckStatus() {
        return checkStatus;
    }

    public void setCheckStatus(int checkStatus) {
        this.checkStatus = checkStatus;
    }

    @Column(name = "count")
    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

//    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "part_id")
    public CbsPartInfoEntity getPart() {
        if(this.part != null){
            this.setPrice(part.getWechatPrice());
            this.setPartName(part.getWechatName());
            this.getPartImg().clear();
            for(CbsPartImageEntity img : part.getPartImgList()){
                this.getPartImg().add(img.getAllPath());
            }
        }
        return part;
    }

    public void setPart(CbsPartInfoEntity part) {
        this.part = part;
    }

    /**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  createName
	 */
	@Column(name ="CREATE_NAME",nullable=true,length=32)
	public java.lang.String getCreateName(){
		return this.createName;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  createName
	 */
	public void setCreateName(java.lang.String createName){
		this.createName = createName;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  createBy
	 */
	@Column(name ="CREATE_BY",nullable=true,length=32)
	public java.lang.String getCreateBy(){
		return this.createBy;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  createBy
	 */
	public void setCreateBy(java.lang.String createBy){
		this.createBy = createBy;
	}
	/**
	 *方法: 取得java.util.Date
	 *@return: java.util.Date  createDate
	 */
	@Column(name ="CREATE_DATE",nullable=true)
	public java.util.Date getCreateDate(){
		return this.createDate;
	}

	/**
	 *方法: 设置java.util.Date
	 *@param: java.util.Date  createDate
	 */
	public void setCreateDate(java.util.Date createDate){
		this.createDate = createDate;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  updateName
	 */
	@Column(name ="UPDATE_NAME",nullable=true,length=32)
	public java.lang.String getUpdateName(){
		return this.updateName;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  updateName
	 */
	public void setUpdateName(java.lang.String updateName){
		this.updateName = updateName;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  updateBy
	 */
	@Column(name ="UPDATE_BY",nullable=true,length=32)
	public java.lang.String getUpdateBy(){
		return this.updateBy;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  updateBy
	 */
	public void setUpdateBy(java.lang.String updateBy){
		this.updateBy = updateBy;
	}
	/**
	 *方法: 取得java.util.Date
	 *@return: java.util.Date  updateDate
	 */
	@Column(name ="UPDATE_DATE",nullable=true)
	public java.util.Date getUpdateDate(){
		return this.updateDate;
	}

	/**
	 *方法: 设置java.util.Date
	 *@param: java.util.Date  updateDate
	 */
	public void setUpdateDate(java.util.Date updateDate){
		this.updateDate = updateDate;
	}
}
